import request from '@/utils/request'

// 创建设备维修记录
export function createMaintenanceRecords(data) {
  return request({
    url: '/devices/maintenance-records/create',
    method: 'post',
    data: data
  })
}

// 更新设备维修记录
export function updateMaintenanceRecords(data) {
  return request({
    url: '/devices/maintenance-records/update',
    method: 'put',
    data: data
  })
}

// 删除设备维修记录
export function deleteMaintenanceRecords(id) {
  return request({
    url: '/devices/maintenance-records/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除设备维修记录 */
export function deleteMaintenanceRecordsList(ids) {
  return request({
    url: `/devices/maintenance-records/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得设备维修记录
export function getMaintenanceRecords(id) {
  return request({
    url: '/devices/maintenance-records/get?id=' + id,
    method: 'get'
  })
}

// 获得设备维修记录分页
export function getMaintenanceRecordsPage(params) {
  return request({
    url: '/devices/maintenance-records/page',
    method: 'get',
    params
  })
}
// 导出设备维修记录 Excel
export function exportMaintenanceRecordsExcel(params) {
  return request({
    url: '/devices/maintenance-records/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}